home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / maestro / source / quotemkr / lnkprtcl.c < prev    next >
Encoding:
Text File  |  1993-06-15  |  24.7 KB  |  618 lines

  1. /*
  2.  * Copyright (c) 1990, 1991, 1992 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, and distribute this software and 
  5.  * its documentation for any purpose is hereby granted without fee, provided
  6.  * that (i) the above copyright notices and this permission notice appear in
  7.  * all copies of the software and related documentation, and (ii) the name
  8.  * Stanford may not be used in any advertising or publicity relating to
  9.  * the software without the specific, prior written permission of
  10.  * Stanford.
  11.  * 
  12.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  13.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  14.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  15.  *
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
  17.  * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
  18.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT
  19.  * ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY,
  20.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21.  * SOFTWARE.
  22.  */
  23.  
  24. /* $Header: /Source/Media/collab/QuoteMaker/RCS/linkProtocol.c,v 2.17 92/09/25 14:33:36 drapeau Exp $ */
  25. /* $Log:    linkProtocol.c,v $
  26.  * Revision 2.17  92/09/25  14:33:36  drapeau
  27.  * Fixed errors in the way the quoted text window was being located.  The
  28.  * earlier version used the XView attributes "XV_WIDTH", "XV_HEIGHT", "XV_X",
  29.  * and "XV_Y".  This version now uses the more proper "frame_get_rect()" and
  30.  * "frame_set_rect()" functions for window placement and sizing.
  31.  * Also, some cosmetic changes were made to enhance readability and ANSI
  32.  * compliance.
  33.  * 
  34.  * Revision 2.16  92/09/12  18:43:38  drapeau
  35.  * Replaced non-portable "irint()" function with simple cast-to-integer syntax.
  36.  * 
  37.  * Revision 2.15  92/05/29  12:41:27  drapeau
  38.  * Modified code to track new name of the MAEstro "Selection" structure;
  39.  * it is now named "MAESelection".
  40.  * 
  41.  * Revision 2.14  92/05/14  15:41:28  drapeau
  42.  * * Updated copyright information.
  43.  * * Other formatting changes to conform to coding standards.
  44.  * 
  45.  * Revision 2.13  92/01/11  01:43:13  drapeau
  46.  * Removed redeclarations of string functions since OpenWindows 2.0
  47.  * headers don't seem to like them (OpenWindows 3.0 seemed to need
  48.  * them).
  49.  * 
  50.  * Revision 2.12  92/01/09  18:25:25  drapeau
  51.  * Slight modifications to make code ANSI-compliant.
  52.  * 
  53.  * Revision 2.11  91/12/31  18:43:21  drapeau
  54.  * Removed the inclusion of string.h, since XView will include the
  55.  * appropriate definitions.
  56.  * 
  57.  * Revision 2.1  91/09/30  15:32:48  derek
  58.  * Changed ShowApplication().
  59.  * 
  60.  * Revision 2.0  91/09/30  15:02:36  derek
  61.  * Version number changed to 2.0.
  62.  * 
  63.  * Revision 1.51  91/09/24  14:47:33  derek
  64.  * In HaltSelection(), I have added a statement checking for 
  65.  * HideQTWAfterPlayingEdit, and QuoteMaker will take the quote window
  66.  * off if this is true.
  67.  * 
  68.  * Revision 1.50  91/09/15  20:06:28  derek
  69.  * The following things are done:
  70.  * 1.      The foreground of mainTextPane and Quote Window are set to be black.
  71.  *         Also, the color of all the text fields are set to black.
  72.  * 2.      Now the quoted text will be shown directly on the Quote Window
  73.  *         when a panel-item selection is made.  The text will also be shown
  74.  *         while the author is highlighting a selection in the text window.
  75.  * 3.      The inconsistency problem regarding text selection is being taken
  76.  *         care of.  When the mouse cursor re-enters the text window,
  77.  *         the selection will be highlighted again.
  78.  * 4.      When the play button is pressed, the text currently selected
  79.  *         in the text window (rather than the text initially associated
  80.  *         with the edit) will be displayed.
  81.  * 5.      The name of the menu_option "Show Quote Window Specifications panel"
  82.  *         is shortened to be "Quote Window Options ..."
  83.  * 6.      A notify_interpose_destroy_func() is being added to fix the bug
  84.  *         that QuoteMaker might exit without killing the Quote Window (which
  85.  *         is also a base window).
  86.  * 7.      When a different font family or font style is selected, the change
  87.  *         will be automatically be reflected on the Quote Window (without the
  88.  *         need to "play" the edit in order to verify the font).  For font
  89.  *         size, the change will be reflected when either a return character is
  90.  *         entered at the text field or when one of those numeric "arrows"
  91.  *         are pressed.
  92.  * 8.      The play button will now flash when an edit is being played.
  93.  *         Pause button will also glow when playing is paused.
  94.  * 9.      In the course of playing, when another edit is selected,
  95.  *         the playing will be stopped.
  96.  * 10.     I have used Saber to clean up the code.
  97.  * 11.     The left-over "NewEditListPopUp" window is removed.
  98.  * 12.     The bug that when quote window is iconified, it wont be un-iconified
  99.  *         when the edit is played in timeline, is fixed.
  100.  * 13.     The DurationEstimate function is changed so that it no longer
  101.  *         needs an edit to be selected first.  It will take textWindowStart
  102.  *         and textWindowEnd directly as input parameters.
  103.  * 
  104.  * 
  105.  * 
  106.  * Revision 1.49  91/09/05  15:48:02  derek
  107.  * The following changes are made:
  108.  * 1.      The name "Quoted Text Window" has been changed to "Quote Window"
  109.  *         in the app.
  110.  * 2.      ShowApplication() and HideApplication() is changed because of the
  111.  *         the change of quote window from a popup to a basewindow.
  112.  * 3.      The QuitProc of QuoteMaker is fixed so that the quote window,
  113.  *         as a base window, will be destroyed separately.
  114.  * 4.      Now hitting return in the label field will not result in adding
  115.  *         a new edit.
  116.  * 5.      Copyright messages are included in front of every .h and .c file.
  117.  * 6.      The scrollbar and the footer of the Quote Window are hidden.
  118.  * 7.      I have changed the include openpanel.h statement in QuoteMaker.c
  119.  *         to include Browse.h.
  120.  * 8.      The delete bug corresponding to the change that the panel-list
  121.  *         must have a choice -- is fixed.  Also, the corresponding bug
  122.  *         for deleteAll is also fixed.
  123.  * 9.      Now, deleteAll and deletion of the last item in Panel_list
  124.  *         will cause the panel-list to be destroyed and a new one will
  125.  *         be created.
  126.  * 10.     GetOpt files have been removed from the directory.  Corresponding
  127.  *         changes are made.
  128.  * 11.     The start and end byte fields are removed from the main panel.
  129.  * 12.     I have put iconify, hide and show quote window to be buttons
  130.  *         instead of menu options.
  131.  * 13.     I have removed the PreviewPanelPopup and incorporated its features into
  132.  *         the main panel.  The three buttons:  pause, play and stop and
  133.  *         the DurationGauge are moved to the main panel.  But the
  134.  *         StatusMessage is removed.
  135.  * 14.     The EnableLocationChange and EnableSizeChange choice setting
  136.  *         are removed.  There are no longer such choices.
  137.  * 15.     Right now if a panel-item is selected and if another panel-item
  138.  *         is picked, the DeselectList() operation in the middle is
  139.  *         eliminated.  This operation involves updating of text fields and
  140.  *         messages and its removal speeds up the program.  The panel-list
  141.  *         must now take at least one choice.  (A choice must be selected
  142.  *         whenever there is at least one item on the list).  And now
  143.  *         there is no way to deselect a list by the user.
  144.  * 16.     The "modified bit" associated with the CurrentSelectionNumberLabel
  145.  *         is implemented.  Now, if a selection is picked, and if either
  146.  *         the quote window is moved or any text fields are changed, the
  147.  *         modified bit will be on.
  148.  * 17.     The Show-text-window button and the Show-quote-window-specifications-popup
  149.  *         button are removed.  They are now menu options under the Options Menu.
  150.  * 18.     The Modify button has its name changed to "Update Edit".
  151.  * 
  152.  * Revision 1.48  91/08/27  14:37:36  derek
  153.  * The following things are done:
  154.  * 1.    The QuotedTextWindow is changed from a base window to a popup window
  155.  *     (now it's called QuotedMaker_quotedTextBaseWindow).  I have also
  156.  *     added a few options: show, hide and iconify QTW and also created
  157.  *     an icon for QTW.
  158.  * 2.    The quoted text will be set in PerformSelection() instead of 
  159.  *     in SetSelection().
  160.  * 3.    I have changed the Document field and the EditList field of 
  161.  *     QuoteMaker so that they will display fill paths.
  162.  * 
  163.  * Revision 1.47  91/08/26  12:10:19  derek
  164.  * The following things are done:
  165.  * 1.    I have added a few notice_prompts to the linkProtocol (network)
  166.  *     functions to give warnings about invalid document names.
  167.  * 2.    The quoted text window will by default be hidden during "blank"
  168.  *     times. ie. when it is not displaying any text.  The interface has
  169.  *     been changed so that it now has a HideQuotedTExtWindowAfterPreview
  170.  *     check box.  The QuotedTextWindow will either stay on the screen
  171.  *     or be hidden as the author desires.
  172.  * 3.    Make the changes corresponding to the changing of name from OpenPanel
  173.  *     to Browse.
  174.  * 4.    The return value bug for OpenHandler, SaveHandler is fixed.
  175.  * 5.    I have changed the code so that Save and SaveAs will behave correctly.
  176.  *     The SaveAs PopUp/Open PopUp are removed.  Browse check is 
  177.  *     incorporated in the applications.
  178.  * 6.    The QuoteMaker file format has been changed.  An EditNumber field    
  179.  *     has been added.
  180.  * 7.    Changes corresponding to the return value by OpenDoc and SetSelection
  181.  *     are made.
  182.  * 8.    GetAppIcon() has been implemented.
  183.  * 9.    Fonts specified in the Edit-list will be preloaded in OpenDoc().
  184.  *     This will hopefully eliminate the startup delay needed to load
  185.  *     the font when we put text onto the Quoted TExt Window for the 
  186.  *     first time.
  187.  * 10.    The "play" button will now play things specified in the 
  188.  *     QuotedTExtWindowSpecificationsPopUp (instead of those specified
  189.  *     in the editList).
  190.  * 11.    The show selection button is replaced by the set selection button.
  191.  *     The Set Selection button willl now not only set the current
  192.  *     edit parameters but will also highlight the corresponding section
  193.  *     in the text.  Also, when one item on the panel-list is clicked on,
  194.  *     the corresponding segment in the text will also be highlighted.
  195.  * 12.    Notify events which tells the app to show the size and location 
  196.  *     of the Quoted Text Window are set up.  ie. those text-fields
  197.  *     on the interface will be updated instantaneously.
  198.  * 16.    editList.label is being sent across the network.
  199.  * 17.    The title bar and the footer of the QuotedTExtWindow are hidden.
  200.  * 
  201.  * Revision 1.46  91/07/15  12:20:04  derek
  202.  * 1.      I have added font selection panel to the application.
  203.  *         Now a user can specify a font by choosing a font family, a font
  204.  *         style and font size.
  205.  * 2.      Location and size fields are added to the application.  User
  206.  *         can specify the size and location of the QuotedTextWindow.
  207.  * 3.      A duration estimate button is added to estimate how long the
  208.  *         the quoted text should last.
  209.  * 4.      Interface has been redesigned to accomodate the addition of
  210.  *         font, size and location functionalities.
  211.  * 6.      EditList file format has been changed to accomodate the new
  212.  *         fields.  They are:  location (x,y), width, height, font family,
  213.  *         font style, font width for QuotedTextWindow.
  214.  * 5.      Two timers have been added in an attempt to ensure accuracy
  215.  *         of gauge-updating in the preview panel.
  216.  * 6.      Command line args are now supported.
  217.  * 7.      I have cleaned up the code by using saber.
  218.  * 8.      Several bugs from previous revision are fixed.
  219.  * 
  220.  * 
  221.  * Revision 1.45  91/07/02  15:07:54  derek
  222.  * QuoteMaker now fully speaks the new MAEstro protocol.
  223.  * 
  224.  * Revision 1.44  91/07/01  18:51:30  derek
  225.  * The following things are done:
  226.  * 1.    The interface is redesigned.  Duration fields are added to each 
  227.  *     edit list.
  228.  * 2.    The function panel (functions Window) is implemented.  The 
  229.  *     application is now capable of being "played", "stopped" and
  230.  *     "paused".  The sense of "time" is now complete.
  231.  * 3.    Makefile fixed.  
  232.  * 4.    Declaration errors left by previous author are cleaned up.
  233.  * 5.    Redundant malloc statements removed.   Certain other
  234.  *     functions are changed to improve code efficiency.
  235.  * 6.    Code cleaned up by saber.  Removed redundant
  236.  *     variables.
  237.  * 
  238.  * Revision 1.43  91/06/28  13:16:02  derek
  239.  * Blank functions added to the code to make the application "compatible"
  240.  * with the new protocol.
  241.  * 
  242.  * Revision 1.42  91/06/27  18:21:18  derek
  243.  * I have cleaned up some of the comments.  No change in code.
  244.  * 
  245.  * Revision 1.41  91/06/19  17:44:59  drapeau
  246.  * No changes; changing RCS revision numbers.
  247.  * 
  248.  * Revision 1.4  91/02/27  03:53:45  drapeau
  249.  * Modified SetSelection() so that the Quoted Text Popup window 'forgets' about
  250.  * previous edits made to it.  This is done to prevent the XView toolkit from
  251.  * bringing up "Unsaved changes made -- do you wish to discard?" messages.
  252.  * These messages are unnecessary for the Quoted Text Popup, since it is meant
  253.  * purely as a display window and not for editing purposes.
  254.  * 
  255.  * Revision 1.3  91/01/05  00:48:35  drapeau
  256.  * Modified SetSelection() so that strings to be placed in the quoted text
  257.  * window are always NULL-terminated.
  258.  * 
  259.  * Revision 1.2  90/12/05  19:22:25  drapeau
  260.  * -- Modified OpenDoc() so that it does not needlessly open edit lists.  a
  261.  *    static variable keeps track of the last document opened; if the current
  262.  *    request is for the same document that the last request sent, the edit
  263.  *    list is not re-opened (since it's already opened).
  264.  * -- Modified OpenDoc() to check for valid filenames being opened.
  265.  * -- Modified SetSelection() to check for invalid selections being requested;
  266.  *    for example, if only 5 items are in the current editList but item #8 is
  267.  *    being requested from the network.
  268.  * 
  269.  * Revision 1.1  90/12/04  17:21:51  drapeau
  270.  * Initial revision
  271.  *  */
  272.  
  273. static char rcsid[] = "$Header: /Source/Media/collab/QuoteMaker/RCS/linkProtocol.c,v 2.17 92/09/25 14:33:36 drapeau Exp $";
  274.  
  275. /*
  276.  * QuoteMaker.c - Notify and event callback function stubs.
  277.  * This file was copied from "QuoteMaker_stubs.c", which was
  278.  * generated by `gxv' from `QuoteMaker.G'.
  279.  * Modified by George Drapeau on October 26, 1990.
  280.  */
  281.  
  282. #include <stdio.h>
  283. #include <sys/param.h>
  284. #include <sys/types.h>
  285. #include <xview/xview.h>
  286. #include <xview/panel.h>
  287. #include <xview/textsw.h>
  288. #include <xview/xv_xrect.h>
  289. #include <gdd.h>
  290. #include "QuoteMaker_ui.h"
  291. #include <sys/stat.h>
  292. #include <xview/font.h>
  293. #include <xview/notice.h>
  294. #include <xview/notify.h>
  295. #include <xview/server.h>          
  296. #include <xview/seln.h>            
  297. #include "Sender.h"
  298. #include "Receiver.h"
  299. #include "quoteMakerDefs.h"
  300.  
  301.  
  302. double   SelectionDuration;
  303. char*    selectedText;
  304.  
  305.  
  306.  
  307. /*--------------------------------------------------------------------------------
  308.   Link Protocol functions
  309.   */
  310.  
  311.  
  312.  
  313.  
  314. void OpenDoc(editListName)
  315.      char**    editListName;
  316. {
  317.   int        result;
  318.   struct stat    fileInfo;
  319.   static char*    lastDocOpened = "Untitled";
  320.   
  321.   EVENT("Open_Doc");
  322.  
  323.   if (*editListName == NULL)                        /* Is an invalid document name being requested? */
  324.   {
  325.     AlertByNoticePrompt(QuoteMaker_baseWindow->baseWindow,
  326.             "Error:  edit-list name is NULL");
  327.     return;                                /* Yes, return without doing anymore work */
  328.   }
  329.   
  330.   if (!strcmp(ShortName(*editListName), "NoneSpecified"))        /* Was the document passed in a valid name? */
  331.   {
  332.     AlertByNoticePrompt(QuoteMaker_baseWindow->baseWindow,
  333.             "Error:  'NoneSpecified' is not a valid edit-list name.");
  334.     return;                                /* No, "NoneSpecified" is not a valid name; leave */
  335.   }
  336.  
  337.   if (!strcmp(*editListName, lastDocOpened))                /* Is the document the same as the last time... */
  338.     return;                                /* ...function was called?  If so, do nothing. */
  339.   lastDocOpened = (char*)strdup(*editListName);                /* Update last document opened */
  340.  
  341.   result = stat(*editListName,&fileInfo);                /* Attempt to get info about the specified file */
  342.   if ((result == 0) && (!(fileInfo.st_mode & S_IFDIR)))            /* Does  file exist (... is it *not* a directory)? */
  343.   {
  344.     ReadEditListFromFile(*editListName, LINK_EDITOR);            /* Yes, the file exists.  Open it and read it in */
  345.     PreloadFontsOntoQTW();
  346.   }
  347.   else
  348.   {
  349.     sprintf(msg, "Error:  Cannot access edit-list file '%s'",
  350.         editListName);
  351.     AlertByNoticePrompt(QuoteMaker_baseWindow->baseWindow,
  352.             msg);
  353.   }
  354. }
  355.   
  356.  
  357.  
  358.  
  359. void SetSelection(MAESelection*    selection)
  360. {
  361.   int            entryNum, start, length, count;
  362.   char*            tempPointer;
  363.   extern double        currentTime;
  364.   char*            index();
  365.   
  366.   EVENT("Set_Selection");
  367.   if (selection->start >= editList.numItems)                /* Check for selection requested not on edit list...*/
  368.   {                                    /* ...ie. edit list has 5 items and request is... */
  369.     AlertByNoticePrompt(QuoteMaker_baseWindow->baseWindow,
  370.             "Error: edit number is bigger than the number of items in the list.");
  371.     return;
  372.   }
  373.   
  374.   currentTime = selection->offset /1000.0;                /* Set offset to current time. */
  375.   entryNum = selection->start;
  376.   if (mostRecentEditNum != NO_CURRENT_EDIT)                /* Is this the 1st time a selection is being made? */
  377.   {                                    /* Yes, don't try to deselect something that... */
  378.     UnHighlightSelection();                        /* ...hasn't been selected yet. */
  379.     DeselectList();
  380.   }                                    /* end if (mostRecentEditNum... */
  381.   xv_set(QuoteMaker_baseWindow->editListScrolledList,            /* Highlight the corresponding item in the...       */
  382.      PANEL_LIST_SELECT, entryNum, TRUE, NULL);            /* ...panel-list.                                   */
  383.   
  384.   SetCurrentSelection(entryNum);                    /* This also positions the quoted text window */
  385.   start = editList.start[entryNum];                    /* Get start and end points for the selection.  */
  386.   SelectionDuration = editList.duration[entryNum];
  387.   
  388.   length = editList.end[entryNum] - start + 1;                /* Calculate size of text to be selected */
  389.   selectedText = (char *) malloc(length + 1);                /* Allocate space for the text to be selected */
  390.   xv_get(QuoteMaker_textWindowPopup->mainTextPane,            /* Get the text to be selected */
  391.      TEXTSW_CONTENTS, start, selectedText, length);
  392.   selectedText[length] = '\0';                        /* Make sure selected text is NULL-terminated */
  393.   for (tempPointer = selectedText, count=0;                /* Go through selected text, looking for newlines... */
  394.        tempPointer;                            /* ...and replace each newline with a space. */
  395.        tempPointer = index(tempPointer, '\n'), count++)
  396.   {
  397.     if (tempPointer != selectedText)                    /* Is "tempPointer" pointing to start of the buffer? */
  398.       tempPointer[0] = ' ';                        /* No, must be pointing to a newline; replace with space... */
  399.     if (count > 100)                            /* If this loop has replaced a large number of ... */
  400.       break;                                /* ...lines, exit loop; chances are the end... */
  401.   }                                    /* ...won't be saved anyway. */
  402.   OldLocX = editList.locX[entryNum];                    /* These statements are added to ensure that the... */
  403.   OldLocY = editList.locY[entryNum];                    /* ...old size and location values are updated so.. */
  404.   OldSizeWidth = editList.sizeWidth[entryNum];                /* ...that the "modify bit" wont be updated by...   */
  405.   OldSizeHeight = editList.sizeHeight[entryNum];            /* ...the notify_interposer.                        */
  406.   
  407.   SetQuotedTextWindowLocation(editList.locX[entryNum],
  408.                   editList.locY[entryNum]);
  409.   SetQuotedTextWindowSize(editList.sizeWidth[entryNum],
  410.               editList.sizeHeight[entryNum]);
  411.   SetQuotedTextWindowFont(editList.fontFamily[entryNum],
  412.               editList.fontStyle[entryNum],
  413.               editList.fontSize[entryNum]);
  414.   
  415.   xv_set(QuoteMaker_quotedTextBaseWindow->quotedTextPane,        /* Allow the Quoted Text popup window to be edited */
  416.      TEXTSW_BROWSING, FALSE , NULL);
  417.   
  418.   length = xv_get(QuoteMaker_quotedTextBaseWindow->quotedTextPane,  /* Get the number of characters currently in the... */
  419.           TEXTSW_LENGTH);                    /* ...popup win. */
  420.   if (length > 0)
  421.     textsw_delete(QuoteMaker_quotedTextBaseWindow->quotedTextPane,  /* Erase any previously shown text in the Text... */
  422.           0, length);                        /* popup window. */
  423.   
  424.   textsw_reset(QuoteMaker_quotedTextBaseWindow->quotedTextPane,0,0); /* Pretend that the QTW was never modified */
  425.   
  426.   Hide(&QuoteMaker_textWindowPopup->textWindowPopup);
  427.   
  428.   return;
  429. }                                    /* end function SetSelection */
  430.  
  431.  
  432.  
  433. void PerformSelection()
  434. {
  435.   EVENT("Perform_Selection");
  436.  
  437.   Playing = TRUE;
  438.  
  439.   if (xv_get(QuoteMaker_quotedTextBaseWindow->quotedTextBaseWindow, /*  If the quote window is iconified, un-iconify... */
  440.          FRAME_CLOSED) == TRUE)                    /*  ...it.                                          */
  441.   {
  442.     xv_set(QuoteMaker_quotedTextBaseWindow->quotedTextBaseWindow,
  443.        FRAME_CLOSED, FALSE, NULL);
  444.   }
  445.   
  446.   xv_set(QuoteMaker_quotedTextBaseWindow->quotedTextBaseWindow,
  447.      XV_SHOW, TRUE, NULL);
  448.  
  449.   xv_set(QuoteMaker_quotedTextBaseWindow->quotedTextPane,        /*  Put the selected text into the quoted Text...   */
  450.      TEXTSW_CONTENTS, selectedText, NULL);                /*  ...popup window.                                */
  451.  
  452.   
  453.   xv_set(QuoteMaker_quotedTextBaseWindow->quotedTextPane,        /*  Allow the Quoted Text popup window to be...     */
  454.      TEXTSW_BROWSING, TRUE, NULL);                    /*  ...edited.                                      */
  455.   
  456.   textsw_normalize_view(QuoteMaker_quotedTextBaseWindow->quotedTextPane,
  457.             0);                        /*  Make sure quoted text shows up at top of...     */
  458.                                     /*  ...popup window.                                */
  459.   AlertStatus("Playing ...");
  460.  
  461.   SetButtonGlowTimer(GLOW_INTERVAL);
  462.  
  463.   SetTimer(SelectionDuration);
  464. }                                    /* end function PerformSelection */
  465.  
  466.  
  467.  
  468.  
  469. char** GetDoc()
  470. {
  471.   static char   *returnValue;
  472.   
  473.   EVENT("Get_Doc");
  474.  
  475.   if (strlen(absoluteEditListName) == 0 ||
  476.       strcmp(absoluteEditListName, "untitled") == 0 ||
  477.       strcmp(absoluteEditListName, "NoneSpecified") == 0)
  478.   {
  479.     returnValue = (char *)strdup("untitled");
  480.   }
  481.   else
  482.   {
  483.     returnValue = absoluteEditListName;
  484.   }
  485.  
  486.   return(&returnValue);
  487. }
  488.  
  489.  
  490.  
  491.  
  492.  
  493. MAESelection* GetSelection(unusedArg)
  494.      void*    unusedArg;
  495. {
  496.   static MAESelection select;
  497.   
  498.   EVENT("Get_Selection");
  499.   
  500.   if (mostRecentEditNum == NO_CURRENT_EDIT)                /*  Return select.duration = -1 if there is no...   */
  501.   {                                    /*  ...current Selection.                           */
  502.     select.duration = -1;
  503.     return(&select);
  504.   }
  505.  
  506.   select.start = mostRecentEditNum;
  507.   select.end = mostRecentEditNum;
  508.   select.offset = 0;
  509.   select.duration = (int)(editList.duration[mostRecentEditNum] * 1000.0);
  510.   
  511.   if (strlen(editList.label[mostRecentEditNum]) == 0)
  512.   {
  513.     strcpy(select.label, "No Label");
  514.   }
  515.   else
  516.   {
  517.     strcpy(select.label, editList.label[mostRecentEditNum]);
  518.   }
  519.  
  520.   return (&select);
  521. }
  522.  
  523.  
  524.  
  525. void
  526.   HaltSelection(MAESelection* selection)
  527. {
  528.   CancelTimer();
  529.   CancelButtonGlowTimer();
  530.   CancelButtonGlow();
  531.   ClearStatusMessage();
  532.   ClearQuotedTextWindow();
  533.  
  534.   if (HideQTWAfterPlayingEdit)
  535.   {
  536.     xv_set(QuoteMaker_quotedTextBaseWindow->quotedTextBaseWindow,
  537.        XV_SHOW, FALSE,
  538.        NULL);
  539.   }
  540.   
  541.   PlayPaused = FALSE;
  542.   Playing = FALSE;
  543. }
  544.  
  545.  
  546. void
  547.   PauseSelection()
  548. {
  549.   PauseButtonHandler(NULL, NULL);
  550. }
  551.  
  552.  
  553. void
  554.   ResumeSelection()
  555. {
  556.   PauseButtonHandler(NULL, NULL);
  557. }
  558.  
  559.  
  560. void
  561.   HideApplication()
  562. {
  563.   xv_set(QuoteMaker_baseWindow->baseWindow, FRAME_CLOSED, TRUE, NULL);
  564.   xv_set(QuoteMaker_quotedTextBaseWindow->quotedTextBaseWindow, FRAME_CLOSED,
  565.      TRUE, NULL);
  566.   XFlush((Display *) xv_get(QuoteMaker_baseWindow->baseWindow, 
  567.                 XV_DISPLAY));
  568. }
  569.  
  570.  
  571. void
  572.   ShowApplication()
  573. {
  574.   xv_set(QuoteMaker_baseWindow->baseWindow, FRAME_CLOSED, FALSE, NULL);
  575.   xv_set(QuoteMaker_quotedTextBaseWindow->quotedTextBaseWindow,FRAME_CLOSED, FALSE, NULL);
  576.   if (xv_get(QuoteMaker_infoPopup->infoPopup, XV_SHOW) == TRUE)
  577.   {
  578.     xv_set(QuoteMaker_infoPopup->infoPopup, XV_SHOW, TRUE, NULL);
  579.   }
  580.   if (xv_get(QuoteMaker_textWindowPopup->textWindowPopup, XV_SHOW) == TRUE)
  581.   {
  582.     xv_set(QuoteMaker_textWindowPopup->textWindowPopup, XV_SHOW, TRUE, NULL);
  583.   }
  584.   if (xv_get(QuoteMaker_QuoteWindowSpecificationsPopup->QuoteWindowSpecificationsPopup,
  585.          XV_SHOW) == TRUE)
  586.   {
  587.     xv_set(QuoteMaker_QuoteWindowSpecificationsPopup->QuoteWindowSpecificationsPopup,
  588.        XV_SHOW, TRUE, NULL);
  589.   }
  590.   XRaiseWindow((Display *)xv_get(QuoteMaker_baseWindow->baseWindow, XV_DISPLAY),
  591.            (Window) xv_get(QuoteMaker_baseWindow->baseWindow, XV_XID));
  592.   
  593.   XRaiseWindow((Display *)xv_get(QuoteMaker_quotedTextBaseWindow->quotedTextBaseWindow, XV_DISPLAY),
  594.            (Window) xv_get(QuoteMaker_baseWindow->baseWindow, XV_XID));
  595.   XFlush((Display *) xv_get(QuoteMaker_baseWindow->baseWindow, 
  596.                 XV_DISPLAY));
  597.   XFlush((Display *) xv_get(QuoteMaker_quotedTextBaseWindow->quotedTextBaseWindow,
  598.                 XV_DISPLAY));
  599. }
  600.  
  601.  
  602. IconData *
  603.   GetAppIcon()
  604. {
  605.   static IconData returnVal;
  606.   static unsigned short baseWindow_bits[] = {
  607. #include "icons/QuoteMaker.icon"
  608.         };
  609.  
  610.   returnVal.iconData = (char *)malloc(sizeof(baseWindow_bits));
  611.   bcopy(baseWindow_bits, returnVal.iconData, sizeof(baseWindow_bits));
  612.  
  613.   if (returnVal.iconData)
  614.     returnVal.dataLength = sizeof(baseWindow_bits);
  615.  
  616.   return(&returnVal);
  617. }
  618.